package priv.wangy.micro.common.exception;


import priv.wangy.micro.common.po.http.rspn.code.IHttpRspnEnum;
import priv.wangy.micro.common.po.http.rspn.code.SysErrorEnum;

/**
 * 用于service层的自定义异常
 *
 * @author zhangjq
 * @since 2023-10-24
 */
public class ServiceException extends Exception {

    private final IHttpRspnEnum error;

    public ServiceException() {
        super(SysErrorEnum.INTERNAL_SYSTEM_ERROR.getRspnMsg());
        this.error = SysErrorEnum.INTERNAL_SYSTEM_ERROR;
    }

    public ServiceException(IHttpRspnEnum error) {
        super(error.getRspnMsg());
        this.error = error;
    }

    public ServiceException(String message, IHttpRspnEnum error) {
        super(message);
        this.error = error;
    }

    public IHttpRspnEnum getError() {
        return this.error;
    }
}
